<template>
    <view class="pub_page pub_page_bg pub_external_page">
        <pub-head ref="pub_header" headerName="external_page" :headerConfig="headerConfig"></pub-head>
        <web-view class="webview" :webview-styles="webviewStyles" :src="url"></web-view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            headerConfig: {
                title: '',//标题栏内容
                left_type: 3,
            },

            webviewStyles: {
                progress: {
                    color: '#006B54'
                }
            },

            url: ''
        };
    },
    onLoad(option) {
        this.headerConfig.title = option.title || 'BEGIN';
        this.url = option.url;
        const that = this;
        uni.getSystemInfo({
            success: function (res) {
                console.log(res.safeArea.height);
                let top = res.safeArea.top + 65;
                let height = res.safeArea.height - 65
                // #ifdef APP-PLUS
                var currentWebview = that.$scope.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
                // console.log(currentWebview);
                setTimeout(function () {
                    let wv = currentWebview.children()[0]
                    wv.setStyle({ top: top, height: height })
                }, 100); //如果是页面初始化调用时，需要延时一下
                // #endif
            }
        });

    },
    methods: {},
};
</script>

<style lang="scss" scoped>
.webview {
    margin-top: calc(130rpx + var(--status-bar-height));
}

// @import "@/common/css/demo.scss";
</style>
